package com.wk.util;

public class TestT9 {

	public static void main(String[] args) {

		//wxyz abc def
		printWord("923");
	}

	private static void printWord(String keyWord) {

		char[] c = keyWord.toCharArray();
		
		// 获取第一个数字对应的字母
		String word=getWordsFromNum(String.valueOf(c[0]));
		char[] d =word.toCharArray();
		// 遍历第一个数字对应的字母
		for(char d1 :d){
			// 从第二个数字开始遍历
			for(int i=1;i<c.length;i++){
				String words=getWordsFromNum(String.valueOf(c[i]));
				char[] w =words.toCharArray();
				for(char ws:w){
					String test =String.valueOf(d1)+String.valueOf(ws);
					System.out.println(test);
				}
				
			}
		}
	}

	private static String getWordsFromNum(String num) {

		String cm = "";
		if ("2".equals(num)) {
			cm = "abc";
		}

		if ("3".equals(num)) {
			cm = "def";
		}

		if ("4".equals(num)) {
			cm = "ghi";
		}
		if ("5".equals(num)) {
			cm = "jkl";
		}
		if ("6".equals(num)) {
			cm = "mno";
		}
		if ("7".equals(num)) {
			cm = "pqrs";
		}
		if ("8".equals(num)) {
			cm = "tuv";
		}
		if ("9".equals(num)) {
			cm = "wxyz";
		}
		return cm;
	}
}
